<%@ page import="com.ws.utils.Res" %><%--
  Created by IntelliJ IDEA.
  User: lufei
  Date: 2025/3/22
  Time: 10:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java"  isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="${ pageContext.request.contextPath}/admin/bootstrap/css/bootstrap.min.css">
	<script src="${ pageContext.request.contextPath}/admin/bootstrap/js/jquery-2.1.0.min.js"></script>
	<script src="${ pageContext.request.contextPath}/admin/bootstrap/js/bootstrap.min.js"></script>
    <style>

       .cus-container{
           width: 1368px;
           margin: 50px auto;
       }
       #user-add .modal-content{
       	padding: 0 20px 20px;	
       }
       #user-edit .modal-content{
       	padding: 0 20px 20px;	
       }
       
    </style>
</head>
<body>

<div class="cus-container">
        <h2 style="text-align: center;color: #1b6d85">
            线路管理
        </h2>
    <div>
        <div id="search-friendlink" style="float: left; margin: 10px 0px;">
            <form class="form-inline" action="${pageContext.request.contextPath}/route/list" method="post">
                <div class="form-group">
                    <label for="exampleInputName2">线路名称</label>
                    <input type="text" name="route_name" value="${routeVo.route_name}" class="form-control" id="exampleInputName2">
                </div>
                &nbsp;
                <div class="form-group">
                    <label for="exampleInputName1">主题</label>
                    <select name="theme_id" id="exampleInputName1" class="form-control">
                        <option value="">请选择主题</option>
                        <c:forEach items="${ThemeList}" var="theme">
                            <option value="${theme.theme_id}" ${routeVo.theme_id== theme.theme_id ?'selected' :''} >${theme.theme_name}</option>
                        </c:forEach>
                    </select>
                </div>
                &nbsp;
                <div class="form-group">
                    <label for="exampleInputName3">供应商</label>
                    <select name="supplier_id" id="exampleInputName3" class="form-control">
                        <option value="">请选择供应商</option>
                        <c:forEach items="${SupplierList}" var="supplier">
                            <option value="${supplier.supplier_id}" ${routeVo.supplier_id== supplier.supplier_id ?'selected' :''}  >${supplier.supplier_name}</option>
                        </c:forEach>
                    </select>
                </div>
                &nbsp;
                <div class="form-group">
                    <label for="exampleInputName4">分类</label>
                    <select name="categorie_id" id="exampleInputName4" class="form-control">
                        <option value="">请选择分类</option>
                        <c:forEach items="${CategorieList}" var="categorie">
                            <option value="${categorie.categorie_id}" ${routeVo.categorie_id== categorie.categorie_id ?'selected' :''} >${categorie.categorie_name}</option>
                        </c:forEach>
                    </select>
                </div>
                &nbsp;
                <div class="form-group">
                    <label for="exampleInputName5">出发地</label>
                    <input type="text" name="route_start_place" value="${routeVo.route_start_place}" class="form-control" id="exampleInputName5">
                </div>
                &nbsp;
                <div class="form-group">
                    <label for="exampleInputName6">目的地</label>
                    <input type="text" name="route_end_place" value="${routeVo.route_end_place}" class="form-control" id="exampleInputName6">
                </div>
                <p></p>
                <div class="form-group">
                    最低价 <input type="text" name="route_price_min" value="${routeVo.route_price_min}" class="form-control" id="exampleInputName7">
                    最高价  <input type="text" name="route_price_max" value="${routeVo.route_price_max}" class="form-control" id="exampleInputName8">
                </div>
                <button type="submit" class="btn btn-default">查询</button>
            </form>
        </div>
        <br>
        <div style="float: right;margin: 10px 0px;">
            <a class="btn btn-primary" href="${ pageContext.request.contextPath}/route/toAdd">添加线路</a>
        </div>
    </div>

       <table class="table table-bordered clearfix" id="friendlink-list">
        <thead>
        	<tr class="bg-primary">
                <th>路线id</th>
                <th>主题名称</th>
                <th>分类名称</th>
                <th>供应商名称</th>
                <th>路线名称</th>
                <th>出发时间</th>
                <th>行程天数</th>
                <th>出发地</th>
                <th>目的地</th>
                <th>路线图片</th>
                <th>收藏数量</th>
                <th>线路价钱</th>
                <th>是否轮播</th>
                <th>是否删除</th>
                <th>创建时间</th>
                <th>操作</th>
	        </tr>
        </thead> 
        <tbody>
        <c:forEach items="${pageInfo.list}" var="route">
            <tr>
                <td>${route.route_id}</td>
                <td>${route.themes.theme_name}</td>
                <td>${route.categories.categorie_name}</td>
                <td>${route.suppliers.supplier_name}</td>
                <td>${route.route_name}</td>
                <td><fmt:formatDate value="${route.route_start_date}" pattern="yyyy-MM-dd"/></td>
                <td>${route.route_tianShu}</td>
                <td>${route.route_start_place}</td>
                <td>${route.route_end_place}</td>
                <td>
                    <img src="<%=Res.fileUrl%>${route.route_image}" width="50px" height="50px">
                </td>
                <td>${route.collection_num}</td>
                <td>${route.route_price}</td>
                <td>${route.is_banner == 1 ? '是' : '否'}</td>
                <c:if test="${route.is_delete == 1}">
                    <td>否</td>
                </c:if>
                <c:if test="${route.is_delete == 0}">
                    <td>是</td>
                </c:if>
                <td><fmt:formatDate value="${route.create_time}" pattern="yyyy-MM-dd"/></td>
                <td>
                    <a class="btn btn-primary" href="${ pageContext.request.contextPath}/route/toUpdate?route_id=${route.route_id}">修改</a>
                    <c:if test="${route.is_delete == 1}">
                         <a class="btn btn-danger" href="${ pageContext.request.contextPath}/route/delete?route_id=${route.route_id}">删除</a>
                    </c:if>
                    <c:if test="${route.is_delete == 0}">
                        <a class="btn btn-danger" href="${ pageContext.request.contextPath}/route/updateDele?route_id=${route.route_id}">取消删除</a>
                    </c:if>

                    <a class="btn btn-primary" href="${pageContext.request.contextPath}/image/toAdd?route_id=${route.route_id}">添加附图</a>
                    <c:if test="${route.is_banner == 0}">
                        <a class="btn btn-primary" href="${pageContext.request.contextPath}/carousel/add?route_id=${route.route_id}">设为轮播</a>
                    </c:if>
                </td>
            </tr>
        </c:forEach>
         </tbody>
      </table>
    <div class="text-center">
        <ul class="pagination">
            <li><a href="${ pageContext.request.contextPath}/route/list?currentPage=1&route_name=${routeVo.route_name}&pageSize=${routeVo.pageSize}">首页</a></li>
            <li><a href="${ pageContext.request.contextPath}/route/list?currentPage=${ pageInfo.prePage}&route_name=${routeVo.route_name}&pageSize=${routeVo.pageSize}">上一页</a></li>
            <c:forEach begin="${ pageInfo.navigateFirstPage}" end="${ pageInfo.navigateLastPage}" var="page">
                <li><a href="${ pageContext.request.contextPath}/route/list?currentPage=${page}&route_name=${routeVo.route_name}&pageSize=${routeVo.pageSize}">${ page}</a></li>
            </c:forEach>
            <li><a href="${ pageContext.request.contextPath}/route/list?currentPage=${ pageInfo.nextPage}&route_name=${routeVo.route_name}&pageSize=${routeVo.pageSize}">下一页</a></li>
            <li><a href="${ pageContext.request.contextPath}/route/list?currentPage=${pageInfo.pages}&route_name=${routeVo.route_name}&pageSize=${routeVo.pageSize}">末页</a></li>
            <li><a>当前第${ pageInfo.pageNum}页</a></li>
            <li><a>共${ pageInfo.pages}页</a></li>
            <li><a>共${ pageInfo.total}条记录</a></li>
            <li>
                <a>
                    每页显示：
                    <select name="pageSize" onchange="sel(this.value)">
                        <option value="2" ${pageInfo.pageSize == 2 ? 'selected' : ''}>2</option>
                        <option value="5" ${pageInfo.pageSize == 5 ? 'selected' : ''}>5</option>
                        <option value="10"${pageInfo.pageSize == 10 ? 'selected' : ''}>10</option>
                    </select>条
                </a>
            </li>
        </ul>
    </div>

 </div>
</body>
</html>
<script>
    function sel(pageSize) {
        location.href = "${ pageContext.request.contextPath}/route/list?currentPage=1&route_name=${routeVo.route_name}&pageSize="+pageSize;
    }
</script>